home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / text / hyper / hsc_source.lha / hsc / source / ugly / ustrlist.c < prev    next >
C/C++ Source or Header  |  1996-10-14  |  2KB  |  103 lines

  1. /*
  2.  * ugly/ustrlist.c
  3.  *
  4.  * string list functions
  5.  *
  6.  * Copyright (C) 1996  Thomas Aglassinger
  7.  *
  8.  * This program is free software; you can redistribute it and/or modify
  9.  * it under the terms of the GNU General Public License as published by
  10.  * the Free Software Foundation; either version 2 of the License, or
  11.  * (at your option) any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  * GNU General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to the Free Software
  20.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  *
  22.  * updated: 14-Oct-1996
  23.  * created: 14-Oct-1996
  24.  *
  25.  *-------------------------------------------------------------------
  26.  *
  27.  */
  28.  
  29. #include <stdlib.h>
  30. #include <stdio.h>
  31. #include <string.h>
  32.  
  33.  
  34. #define NOEXTERN_UGLY_USTRLIST_H
  35. #include "ustrlist.h"
  36.  
  37. /*
  38.  * del_string_node
  39.  */
  40. VOID del_string_node(APTR data)
  41. {
  42.     STRPTR s = (STRPTR) data;
  43.     ufreestr(s);
  44. }
  45.  
  46. /*
  47.  * new_string_node
  48.  */
  49. STRPTR new_string_node(STRPTR data)
  50. {
  51. #if 0
  52.     D(fprintf(stderr, DHL "new string `%s'\n", data);
  53. #endif
  54.     return (strclone(data));
  55. }
  56.  
  57. /*
  58.  * cmp_string_node
  59.  */
  60. int cmp_string_node(APTR cmp_data, APTR lst_data)
  61. {
  62.     STRPTR s1 = (STRPTR) cmp_data;
  63.     STRPTR s2 = (STRPTR) lst_data;
  64.  
  65. #ifdef DEBUG_UGLY
  66.     if (!cmp_data)
  67.         panic("cmp_data = NULL");
  68.     if (!lst_data)
  69.         panic("lst_data = NULL");
  70. #endif
  71.  
  72.     if (!strcmp(s1, s2))
  73.         return (-1);
  74.     else
  75.         return (0);
  76. }
  77.  
  78. /*
  79.  * del_strlist: cleanup whole list of strings
  80.  */
  81. VOID del_strlist(DLLIST *list)
  82. {
  83.     del_dllist(list);
  84. }
  85.  
  86. /*
  87.  * del_strlist: cleanup whole list of strings
  88.  */
  89. VOID clr_strlist(DLLIST *list)
  90. {
  91.     del_all_dlnodes(list);
  92. }
  93.  
  94. /*
  95.  * init_strlist: set up new list of strings
  96.  */
  97. DLLIST *init_strlist(VOID)
  98. {
  99.     return( init_dllist(del_string_node) );
  100. }
  101.  
  102.  
  103.